﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using QLNH_DAO_WS.DataEntity;

namespace QLNH_DAO_WS
{
    /// <summary>
    /// Summary description for QLNH_DAO_WebService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class QLNH_DAO_WebService : System.Web.Services.WebService
    {
        #region KhuVuc Service
        [WebMethod]
        public List<KhuVuc> LayDanhSachKhuVuc()
        {
            KhuVucDAO kvDAO = new KhuVucDAO();
            return kvDAO.LayDanhSach();
        }

        [WebMethod]
        public KhuVuc LayKhuVucBangID(int id)
        {
            KhuVucDAO kvDAO = new KhuVucDAO();
            return kvDAO.LayDuLieuBangID(id);
        }

        [WebMethod]
        public void ThemKhuVuc(KhuVuc kv)
        {
            KhuVucDAO kvDAO = new KhuVucDAO();
            kvDAO.Them(kv);
        }

        [WebMethod]
        public void XoaKhuVuc(int id)
        {
            KhuVucDAO kvDAO = new KhuVucDAO();
            KhuVuc kv = LayKhuVucBangID(id);
            kv.Xoa = true;
            kvDAO.Xoa();
        }

        [WebMethod]
        public void CapNhat(KhuVuc kv)
        {
            KhuVucDAO kvDAO = new KhuVucDAO();
            kvDAO.CapNhat(kv);
        }
        #endregion

    }
}
